package com.market.sys.util;

import com.fasterxml.jackson.annotation.JsonAlias;
import com.fasterxml.jackson.annotation.JsonProperty;

import java.io.Serializable;
import java.util.Objects;

public class PageForm implements Serializable {

	private static final long serialVersionUID = 1L;

	/**默认每页返回数据量*/
	private static final Integer	DEFAULT_PAGE_SIZE = 10;

	@JsonProperty("current")
	@JsonAlias(value = {"pageNo","current"})
	private	Integer	pageNo	=	1;

	@JsonProperty("size")
	@JsonAlias(value = {"pageSize","size"})
	private	Integer	pageSize	=	DEFAULT_PAGE_SIZE;


	public PageForm() {
		super();
	}

	public PageForm(Integer pageNo, Integer pageSize) {
		super();
		this.pageNo = pageNo;
		this.pageSize = pageSize;
	}

	public Integer getPageNo() {
		if (Objects.isNull(pageNo)) {
			this.pageNo = 1;
		}
		return pageNo;
	}

	public void setPageNo(Integer pageNo) {
		this.pageNo = pageNo;
	}

	public Integer getPageSize() {
		if (Objects.isNull(pageSize)) {
			this.pageSize = DEFAULT_PAGE_SIZE;
		}
		return pageSize;
	}

	public void setPageSize(Integer pageSize) {
		this.pageSize = pageSize;
	}
}
